package com.dolphin.business.manager.impl;

import com.dolphin.business.common.utils.PagerModel;
import com.dolphin.business.entity.Type;
import com.dolphin.business.manager.AbstractManager;
import com.dolphin.business.manager.TypeManager;

public class TypeManagerImpl extends AbstractManager implements TypeManager {

	@Override
	public void addType(Type type) {

		getHibernateTemplate().save(type);
	}

	@Override
	public void delTypeById(String id) {
		
		getHibernateTemplate().delete(findTypeById(id));
	}

	@Override
	public PagerModel findAllTypes() {

		return searchPaginate("select t from Type t");
	}

	@Override
	public Type findTypeById(String id) {

		return (Type)getHibernateTemplate().load(Type.class, id);
	}

	@Override
	public void updateType(Type type) {

		getHibernateTemplate().update(type);
	}

}
